<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>jquery源码解析</title>
  </head>
  <body>
    <script src="./jquery.1.0.1.js"></script>
    <!-- <script src="./jquery-3.4.1.js"></script> -->
    <script>
      // 参数必须是对象
      // 当传递多个参数的时候，任意对象扩展
      var info = { name: "lucy", info: { weight: "45kg" } };
      var newInfo = { age: 20, sex: "女", info: { like: "乒乓球" } };
      var result = $().extend(true,{}, info, newInfo);
      console.log(result); // 对象扩展后 {name:'lucy', age:20, sex:"女" }
        // 实例对象扩展
        $.fn.extend({
            age: 30,
            goto:function(){
              console.log("跳转到...")
              }
        });
        console.log($().age) // 30
        $().goto()

        // jquery 本身扩展
        $.extend({
          age:18,
          work: function() {
            console.log('去工作');
          }
        });
        $.work() // 去工作
        console.log($.age) // 18
    </script>
  </body>
</html>
